
<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<script src="../js/vue2.6.12.js" type="text/javascript" charset="utf-8"></script>
		 <script src="https://unpkg.com/axios/dist/axios.min.js"></script>
	</head>
	<body>
		<div id="app">
			<button @click="getData">获取数据</button>
			
			<child1 v-for="(item,index) in lists" :key="index" :lst="item" @det="urlf"></child1>
			
			<child2 :ul="url"></child2>
		</div>
	</body>
	<script type="text/javascript">
		
		Vue.component("child1",{
			props:["lst"],
			template:`
				<div>
					{{lst.name}} <button @click="xq" >详情</button>
				</div>
			`,
			methods:{
				xq(){
					this.$emit("det",this.lst.postUrlForShare);
				}
			}
		});
		
		Vue.component("child2",{
			props:['ul'],
			template:`
				<div>
					<p style="margin-top:20px;font-size:30px;">{{this.ul}}</p>
				</div>
			`,
		});
		
		
		var vm = new Vue({
			el:'#app',
			data:{
				lists:'',
				url:''
			},
			methods:{
				getData(){
					axios.get("../json/info.json").then((data)=>{
						this.lists=data.data.data;
					})
				},
				urlf(da){
					this.url=da;
				}
			},
			
		})
	</script>
</html>
